package com.service.Authorization.service.impl;

import com.service.Authorization.entity.ReviewRecordInfo;
import com.service.Authorization.dao.ReviewRecordInfoDao;
import com.service.Authorization.service.ReviewRecordInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 审核记录表(ReviewRecordInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-08-10 16:14:32
 */
@Service("reviewRecordInfoService")
public class ReviewRecordInfoServiceImpl implements ReviewRecordInfoService {
    @Resource
    private ReviewRecordInfoDao reviewRecordInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ReviewRecordInfo queryById(String id) {
        return this.reviewRecordInfoDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<ReviewRecordInfo> queryAllByLimit(int offset, int limit) {
        return this.reviewRecordInfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param reviewRecordInfo 实例对象
     * @return 实例对象
     */
    @Override
    public ReviewRecordInfo insert(ReviewRecordInfo reviewRecordInfo) {
        this.reviewRecordInfoDao.insert(reviewRecordInfo);
        return reviewRecordInfo;
    }

    /**
     * 修改数据
     *
     * @param reviewRecordInfo 实例对象
     * @return 实例对象
     */
    @Override
    public ReviewRecordInfo update(ReviewRecordInfo reviewRecordInfo) {
        this.reviewRecordInfoDao.update(reviewRecordInfo);
        return this.queryById(reviewRecordInfo.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.reviewRecordInfoDao.deleteById(id) > 0;
    }
}
